<include file="Public/header"/>
<div class="row">
    <div class="wrapper wrapper-content animated">
        <div class="ibox-content">
            <div class="deal-bd order-bottom">委托结算管理</div>
            <div class="deposit-box">
                <div class="deposit-item">
                    <div class="row">
                        <div class="col-xs-6 col-md-4 ">
                            <div class="num-box">
                                <div class="left-img"><img src="Public/Front/img/icon-1.png" alt=""></div>
                                <div class="right-num">
                                    <p class="num-title">账户金额</p>
                                    <p class="main-num"><{$info['balance']}> 元</p>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-6 col-md-4 ">
                            <div class="num-box">
                                <div class="left-img"><img src="Public/Front/img/icon-1.png" alt=""></div>
                                <div class="right-num">
                                    <p class="num-title">可用余额</p>
                                    <p class="main-num"><{$info['availableBalance']}>元</p>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-6 col-md-4 " >
                            <div class="num-box">
                                <div class="left-img"><img src="Public/Front/img/icon-1.png" alt=""></div>
                                <div class="right-num">
                                    <p class="num-title">冻结
                                        <span style="float: right;margin-left:50px;">
                                                <i class="layui-icon layui-icon-about popover-hide"
                                                   title="注意" data-container="body"
                                                   data-toggle="popover" data-placement="right" data-content="T1&D1额度每天凌晨自动解冻"
                                                   data-trigger="hover"
                                                   style="font-size: 26px; color: red;"></i>
                                            </span>
                                    </p>
                                    <php>$amount = $account['t1']+$account['d1'];</php>
                                    <p class="main-num"><{$amount}> 元</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <form class="layui-form" action="<{:U('Withdrawal/saveEntrusted')}>" method="post" autocomplete="off"
                      enctype="multipart/form-data">
                    <input type="hidden" name="userid" value="<{$info[id]}>">
                    <input type="hidden" name="balance" id="availableBalance" value="<{$info['availableBalance']}>">
                    <input type="hidden" name="tktype" id="tktype" value="<{$tkconfig[tktype]}>">
                    <switch name="tkconfig[tktype]">
                        <case value="0">
                            <input type="hidden" name="feilv" id="feilv" value="<{$tkconfig[sxfrate]}>">
                        </case>
                        <case value="1">
                            <input type="hidden" name="feilv" id="feilv" value="<{$tkconfig[sxffixed]}>">
                        </case>
                    </switch>
                    <div class="layui-form-item">
                        <label class="layui-form-label">提现金额：</label>
                        <div class="layui-input-block">
                            <input type="number" name="u[money]" lay-verify="required" id="money"
                                   autocomplete="off" onchange="calculate_rate(<{$info[id]}>)"
                                   placeholder="0.00" class="layui-input" value=""
                                   onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}">
                            <div class="layui-form-mid layui-word-aux">注：提现金额最小<{$tkconfig.tkzxmoney}>元，且是整数。含提现手续费,直接在金额中扣除.</div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">到账金额：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="u[amount]" lay-verify="" id="amount" readonly autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">手续费：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="u[brokerage]" id="brokerage" lay-verify="" readonly autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">选择结算银行卡</label>
                        <div class="layui-input-block">
                            <select name="u[bank]" lay-filter="">
                                <option value=""></option>
                                <volist name="bankcards" id="b">
                                    <option value="<{$b.id}>" <if condition="$b.isdefault eq 1">selected</if> ><{$b.bankname}>(<{$b.cardnumber}>|<{$b.accountname}>)</option>
                                </volist>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">支付密码：</label>
                        <div class="layui-input-inline">
                            <input type="password" name="password" lay-verify="pass" placeholder="请输入支付密码" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">谷歌动态口令：</label>
                        <div class="layui-input-inline">
                            <input type="password" name="googleCode" lay-verify="pass" placeholder="请输入动态口令" autocomplete="off" class="layui-input">
                        </div>
                    </div>


                    <!--<include file="Public/send"/> -->

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="btn btn-primary" type="submit" lay-filter="save">提交申请</button>
                            <button type="reset" class="btn btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<include file="Public/footer"/>
<script>
    var issubmit=false;
    layui.use(['form', 'layer','element'], function(){
        var layer = layui.layer //弹层
            ,form = layui.form
            ,element = layui.element; //元素操作

        //监听提交
        // form.on('submit(save)', function(data){
        //     layer.confirm('确定提现'+$("#money").val()+"元？", {
        //         btn: ['确定','取消'] //按钮
        //     }, function(){
        //         $.ajax({
        //             url:"<{:U('Withdrawal/saveClearing')}>",
        //             type:"post",
        //             data:$('#calculate').serialize(),
        //             success:function(res){
        //                 if(res.status){
        //                     layer.alert("申请成功", {icon: 6},function () {
        //                         location.reload();
        //                         var index = parent.layer.getFrameIndex(window.name);
        //                         parent.layer.close(index);
        //                     });
        //                 }else{
        //                     layer.alert(res.msg ? res.msg : "申请失败", {icon: 5},function () {
        //                         location.reload();
        //                         var index = parent.layer.getFrameIndex(window.name);
        //                         parent.layer.close(index);
        //                     });
        //                 }
        //             }
        //         });
        //     }, function(){
        //
        //     });
        //
        //     return false;
        // });
    });

    /*手续费计算*/
    function calculate_rate(userid){
        var type = $('#tktype').val()
            ,money = $('#money').val()
            ,feilv = $('#feilv').val()
            ,availableBalance = $('#availableBalance').val();
        $.ajax({
            url:"<{:U('Withdrawal/calculaterate')}>",
            type:'post',
            data:'userid='+userid+'&money='+money+'&availableBalance='+availableBalance+"&tktype="+type+'&feilv='+feilv,
            success:function(res){
                if(res.status){
                    $('#amount').val(res.data.amount);
                    $('#brokerage').val(res.data.brokerage);
                }else{
                    layer.alert(res.msg ? res.msg :"操作失败", {icon: 5},function () {
                        location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    });
                }
            }
        });
    }
</script>
</body>
</html>